package com.ticket.common.time;

import org.apache.commons.lang.time.FastDateFormat;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DatePrinter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;
import java.util.List;

public class CommonFunction {
    private static Logger logger = LoggerFactory.getLogger(CommonFunction.class);
    private static String fullfmt = "yyyy-MM-dd' 'HH:mm:ss' 'SSS";
    private static String totalfullfmt = "yyyyMMddHHmmssSSS";
    private static String fullfmt2 = "yyyyMMddHHmmssSS";
    private static String datefmt = "yyyyMMdd";
    private static String time6fmt = "HHmmss";
    private static String time4fmt = "HHmm";
    private static String date6fmt = "yyMMdd";
    private static String time8fmt = "HH:mm:ss";
    private static String time14fmt = "yyyyMMddHHmmss";
    private static String time14fmt1 = "yyyy-MM-dd HH:mm:ss";
    private static String fullfmt4 = "yyyy/MM/dd HH:mm:ss";
    private static String fullfmt5 = "yyyyMMddHHmm";
    private static String fullMilliFmt = "yyyyMMddHHmmssSSS";
    public static String getLocalTime14() {
        return format(new Date(), fullfmt5);
    }
    public static String format(Date date, String pattern) {
        return DateFormatUtils.format(date, pattern);
    }





    public static String Toyymmdd(String str){
        StringBuilder sb = new StringBuilder(str);// 构造一个StringBuilder对象
        sb.insert(4, "/");// 在指定的位置，插入指定的字符串
        sb.insert(7, "/");// 在指定的位置，插入指定的字符串
        sb.insert(10, " ");// 在指定的位置，插入指定的字符串
        sb.insert(13, ":");// 在指定的位置，插入指定的字符串
        str = sb.toString();
        return str;
    }
}
